package GUI;
import javax.swing.JTextArea;
import javax.swing.JLabel;

import MessagePacks.GetAllPack;
import MessagePacks.MessagePack;

import java.awt.Font;

/**
 *@author Juan Alapin - 324507516
 *@author Giora Yaffe - 036551281
 *@author Shachar Gritzman - 300174026
 *@author Nir Porat - 021515580
*/

public class Performance extends IS_dep_manager{
	
	private static final long serialVersionUID = 1L;
	private MainGUI mainGui;
	private JTextArea numApproved,addedToOrig; 
	private GetAllPack sum,count; 
	
	public Performance(MainGUI mainGui) {
		super(mainGui);
		this.mainGui= mainGui;
		
		getSum();
		getCount();
		numApproved = new JTextArea();
		numApproved.setEditable(false);
		numApproved.setBounds(616, 152, 82, 28);
		getContentPane().add(numApproved);
		
		JLabel lblNewLabel = new JLabel("Number of extentions that approved:");
		lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 14));
		lblNewLabel.setBounds(296, 152, 280, 28);
		getContentPane().add(lblNewLabel);
		
		JLabel lblPerformanceMenue = new JLabel("Performance Menue:");
		lblPerformanceMenue.setFont(new Font("Tahoma", Font.BOLD, 17));
		lblPerformanceMenue.setBounds(350, 67, 183, 34);
		getContentPane().add(lblPerformanceMenue);
		
		JLabel lblNumberOf = new JLabel("Number of levels that added to original: ");
		lblNumberOf.setFont(new Font("Tahoma", Font.BOLD, 14));
		lblNumberOf.setBounds(296, 236, 280, 23);
		getContentPane().add(lblNumberOf);
			
		addedToOrig = new JTextArea();
		addedToOrig.setEditable(false);
		addedToOrig.setBounds(616, 231, 82, 28);
		getContentPane().add(addedToOrig);
		
		numApproved.setText(Integer.toString(sum.getNumber()));
		addedToOrig.setText(Integer.toString(count.getNumber()));
	}
	public void getSum() {
		sum= new GetAllPack(MessagePack.getSumOfexte);
		mainGui.client.handleMessageFromClientUI(sum);
		sum= (GetAllPack) mainGui.client.getMessage(); 
		
	}
	public void getCount() {
		count= new GetAllPack(MessagePack.getCountOfPref);
		mainGui.client.handleMessageFromClientUI(count);
		count= (GetAllPack) mainGui.client.getMessage(); 

}
}